﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Database.Models
{
    [Table("CanBo")]
    public class CanBo : BaseModel
    {
        public int Id { get; set; }

        [Required]
        [MaxLength(255)]
        public string HoTen { get; set; }

        [MaxLength(255)]
        public string DienThoai { get; set; }

        [MaxLength(2000)]
        public string DienGiai { get; set; }

        public virtual Doi Doi { get; set; }

        [NotMapped]
        public virtual string TenDoi
        {
            get
            {
                if (Doi != null)
                {
                    return Doi.TenDoi;
                }
                return string.Empty;
            }
        }

        [NotMapped]
        public virtual string TenPhong
        {
            get
            {
                if (Doi != null)
                {
                    return Doi.TenPhong;
                }
                return string.Empty;
            }
        }
    }
}